<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Autenticacao
 *
 * @author felipe
 */
class Voitech_Plugins_Autenticacao extends Zend_Controller_Plugin_Abstract {
        /**
	 * Metodo que defini se o usuario pode ou não acessar a url desejada
	 */
	public function preDispatch(Zend_Controller_Request_Abstract $request){		
            $controller = strtolower($request->getControllerName());        
            if($controller != 'error' and $controller != 'autenticacao'){
                $auth 			= Zend_Auth::getInstance();                
                if(!$auth->hasIdentity()){
                    $request->setControllerName('autenticacao')
                            ->setActionName('index');
                }
                
            }			
	}	
}

?>
